package com.symc.sims0213xfw.controller;

import com.symc.sims0213xfw.bean.College;
import com.symc.sims0213xfw.service.impl.CollegeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

/**
 * @Author: 凤文  沈阳医学院2019级医学信息工程 0213
 * @CreateTime: 2022/01/26 13:59
 * @Description:
 */
@WebServlet("/optionsServlet")
public class OptionsServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session = req.getSession();
        List<College> optionalCollegeList = new CollegeServiceImpl().getOptionalCollegeList();
        session.setAttribute("college", optionalCollegeList);
        resp.sendRedirect(req.getContextPath() + "/jsp/student/addStudent.jsp");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
